package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyMdYydzDetail;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyMdYydzDetailParam;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyMdYydzParam;
import cn.stylefeng.guns.sys.modular.system.service.BtyMdYydzDetailService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 营业额报备详情表控制器
 *
 * @author 
 * @Date 2021-12-03 17:15:18
 */
@Controller
@RequestMapping("/btyMdYydzDetail")
public class BtyMdYydzDetailController extends BaseController {

    private String PREFIX = "/modular/system/btyMdYydzDetail";

    @Autowired
    private BtyMdYydzDetailService btyMdYydzDetailService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyMdYydzDetail.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyMdYydzDetail_add.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyMdYydzDetail_edit.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        this.btyMdYydzDetailService.add(btyMdYydzDetailParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        this.btyMdYydzDetailService.update(btyMdYydzDetailParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        this.btyMdYydzDetailService.delete(btyMdYydzDetailParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2021-12-03
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        BtyMdYydzDetail detail = this.btyMdYydzDetailService.getById(btyMdYydzDetailParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2021-12-03
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        return this.btyMdYydzDetailService.findPageBySpec(btyMdYydzDetailParam);
    }

    /**
     * 推送消息接口-督导
     *
     */
    @RequestMapping("/pushDdMsg")
    @ResponseBody
    public ResponseData pushDdMsg(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        this.btyMdYydzDetailService.pushDdMsg(btyMdYydzDetailParam);
        return ResponseData.success();
    }

    /**
     * 推送消息接口-店长
     *
     */
    @RequestMapping("/pushDzMsg")
    @ResponseBody
    public ResponseData pushDzMsg(BtyMdYydzDetailParam btyMdYydzDetailParam) {
        this.btyMdYydzDetailService.pushDzMsg(btyMdYydzDetailParam);
        return ResponseData.success();
    }

    /**
     * APP新增报备
     *
     */
    @RequestMapping("/addReport")
    @ResponseBody
    public ResponseData addReport(BtyMdYydzDetailParam param, String account) {
        if (ToolUtil.isEmpty(account)){
            return ResponseData.error("电话不能为空！");
        }
        this.btyMdYydzDetailService.addReport(param, account);
        return ResponseData.success();
    }

    /**
     * APP营业额报备记录列表
     * @return
     */
    @ResponseBody
    @RequestMapping("/reprotList")
    public LayuiPageInfo reprotList(BtyMdYydzDetailParam btyMdYydzDetailParam){
        return this.btyMdYydzDetailService.reprotList(btyMdYydzDetailParam);
    }

    /**
     * APP营业额对账待回复列表
     * @return
     */
    @ResponseBody
    @RequestMapping("/noReplyList")
    public LayuiPageInfo noReplyList(BtyMdYydzDetailParam btyMdYydzDetailParam){
        return this.btyMdYydzDetailService.noReplyList(btyMdYydzDetailParam);
    }

    /**
     * APP营业额对账已回复列表
     * @return
     */
    @ResponseBody
    @RequestMapping("/replyList")
    public LayuiPageInfo replyList(BtyMdYydzDetailParam btyMdYydzDetailParam){
        return this.btyMdYydzDetailService.replyList(btyMdYydzDetailParam);
    }

    /**
     * APP营业额对账回复
     *
     */
    @RequestMapping("/editReply")
    @ResponseBody
    public ResponseData editReply(BtyMdYydzDetailParam btyMdYydzDetailParam, String account) {
        if (ToolUtil.isEmpty(account)){
            return ResponseData.error("电话不能为空！");
        }
        this.btyMdYydzDetailService.editReply(btyMdYydzDetailParam, account);
        return ResponseData.success();
    }

    /**
     * APP获取当前日期
     *
     */
    @RequestMapping("/now")
    @ResponseBody
    public ResponseData now(){
        return this.btyMdYydzDetailService.now();
    }
}


